import 'package:fish_redux/fish_redux.dart';

enum MainViewAction {
  action,
  onGetData,
  onTapSort,
  setSort,
  onLoad,
  onSetItems,
  onRefresh,
  onCallPhone,
  onSetMultipleSelect,
  onSelectAll,
  onGetAllOrder,
  onSelectOne,
  onNewInstall,
  onTap,
  onSwitchCheckLeaderType,
}

class MainViewActionCreator {
  static Action onAction() {
    return const Action(MainViewAction.action);
  }

  static Action onSwitchCheckLeaderType() {
    return const Action(MainViewAction.onSwitchCheckLeaderType);
  }

  static Action onGetData(data) {
    return Action(MainViewAction.onGetData, payload: data);
  }

  static Action onTapSort(index) {
    return Action(MainViewAction.onTapSort, payload: index);
  }

  static Action setSort(index) {
    return Action(MainViewAction.setSort, payload: index);
  }

  static Action onLoad(page) {
    return Action(MainViewAction.onLoad, payload: page);
  }

  static Action onSetItems(data, page) {
    return Action(MainViewAction.onSetItems,
        payload: {'items': data, 'page': page});
  }

  static Action onRefresh() {
    return const Action(MainViewAction.onRefresh);
  }

  static Action onCallPhone(data) {
    return Action(MainViewAction.onCallPhone, payload: data);
  }

  static Action onSetMultipleSelect() {
    return const Action(MainViewAction.onSetMultipleSelect);
  }

  static Action onSelectAll() {
    return const Action(MainViewAction.onSelectAll);
  }

  static Action onGetAllOrder() {
    return const Action(MainViewAction.onGetAllOrder);
  }

  static Action onSelectOne(data) {
    return Action(MainViewAction.onSelectOne, payload: data);
  }

  static Action onNewInstall() {
    return const Action(MainViewAction.onNewInstall);
  }

  static Action onTap(data) {
    return Action(MainViewAction.onTap, payload: data);
  }
}
